DefaultVideoPlayerState

Implementation of VideoPlayerState for WebAssembly/JavaScript platform. Manages the state of a video player including playback controls, media information, and error handling.

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
var applyPlaybackSpeedCallback: (Float) -> Unit?

Callback to apply playback speed changes to the underlying media player

Link copied to clipboard
var applyVolumeCallback: (Float) -> Unit?

Callback to apply volume changes to the underlying media player

Link copied to clipboard
open override val aspectRatio: Float
Link copied to clipboard
open override val availableSubtitleTracks: <Error class: unknown class>
Link copied to clipboard
Link copied to clipboard
open override val currentTime: Double
Link copied to clipboard
open override val durationText: String

Returns the total duration of the video as a formatted string.

Link copied to clipboard
open override val error: VideoPlayerError?
Link copied to clipboard
open override val hasMedia: Boolean
Link copied to clipboard
open override var isFullscreen: Boolean
Link copied to clipboard
open override val isLoading: Boolean
Link copied to clipboard
open override val isPlaying: Boolean

Indicates whether the video is currently playing.

Link copied to clipboard
open override val leftLevel: Float

Provides the audio level for the left channel as a percentage.

Link copied to clipboard
open override var loop: Boolean

Specifies if the video should loop when it reaches the end.

Link copied to clipboard
open override val metadata: VideoMetadata
Link copied to clipboard
open override var playbackSpeed: Float
Link copied to clipboard

Callback function to force recalculation of the HTML view position. This is set by the VideoPlayerSurface when the HTML view is created.

Link copied to clipboard
open override val positionText: String

Returns the current playback position as a formatted string.

Link copied to clipboard
open override val rightLevel: Float

Provides the audio level for the right channel as a percentage.

Link copied to clipboard
open override var sliderPos: Float

Represents the current playback position as a normalized value between 0.0 and 1.0.

Link copied to clipboard
val sourceUri: String?
Link copied to clipboard
open override var subtitleBackgroundColor: Color
Link copied to clipboard
open override var subtitlesEnabled: Boolean
Link copied to clipboard
open override var subtitleTextStyle: TextStyle
Link copied to clipboard
open override var userDragging: Boolean

Denotes whether the user is manually adjusting the playback position.

Link copied to clipboard
open override var volume: Float

Controls the playback volume. Valid values are within the range of 0.0 (muted) to 1.0 (maximum volume).

Functions

Link copied to clipboard
open override fun clearError()

Clears any error state.

Link copied to clipboard
open override fun disableSubtitles()

Disables subtitles by clearing the current track and setting subtitlesEnabled to false.

Link copied to clipboard
open override fun dispose()

Disposes of resources used by the player.

Link copied to clipboard

Forces recalculation of the HTML view position. This is useful when the layout changes and the HTML view needs to be repositioned.

Link copied to clipboard
fun onTimeUpdate(currentTime: Float, duration: Float, forceUpdate: Boolean = false)

Callback for time update events from the media player.

Link copied to clipboard
open override fun openFile(file: PlatformFile, initializeplayerState: InitialPlayerState)

Opens a media file.

Link copied to clipboard
open override fun openUri(uri: String, initializeplayerState: InitialPlayerState)

Opens a media source from the given URI.

Link copied to clipboard
open override fun pause()

Pauses playback of the current media.

Link copied to clipboard
open override fun play()

Starts or resumes playback of the current media. If no media is loaded but a previous URI exists, reopens that media.

Link copied to clipboard
open override fun seekTo(value: Float)

Seeks to a specific position in the media.

Link copied to clipboard
open override fun selectSubtitleTrack(track: SubtitleTrack?)

Selects a subtitle track and enables subtitles.

Link copied to clipboard

Sets the error state.

Link copied to clipboard
open override fun stop()

Stops playback and resets the player state. Note: lastUri is preserved for potential replay.

Link copied to clipboard
open override fun toggleFullscreen()

Toggles the fullscreen state of the video player

Link copied to clipboard
fun updateAudioLevels(left: Float, right: Float)

Updates the audio level indicators.

Link copied to clipboard
fun updatePosition(currentTime: Float, duration: Float, forceUpdate: Boolean = false)

Updates the position and duration display.